#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "locketcipher.h"
#include "lockethttpagent.h"


int main(int argc, char *argv[])
{
    (void) argc;
#ifdef WIN32 
    setvbuf (stdout, NULL, _IONBF, 0);
#endif
    LOCKET_CIPHER_Init ();

    char *host = argv[1];
    int proxy_mode = HTTPS_PROXY;
    int port = 0;
    if (0 == strncmp ("HTTP", argv[2], strlen(argv[2])))
    {
        proxy_mode = HTTP_PROXY;
        port = 80;
    }
    else
    {
        proxy_mode = HTTPS_PROXY;
        port = 443;
    }
    printf ("port:%d, proxy:%s\n", port, argv[2]);

    int iErr = LOCKET_HTTPAGENT_Init(host, port, proxy_mode);
    if (0 != iErr)
    {
        fprintf(stdout, "LOCKET %s proxy init failed.\n", argv[2]);
        return 0;
    }

    return 0;
}

